//Ajax request function
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}


//validate register member
function validateRegisterMember()
{
	//alert("hi");
	var frmReg=document.getElementById("frmRegisterMember");
	var flag=0;
	if(frmReg.firstName.value==""){
	flag=flag+1;
	document.getElementById("lblFirstName").style.fontWeight="bold";
	document.getElementById("lblFirstName").style.color="#FF0000";
	}
	else{
	document.getElementById("lblFirstName").style.fontWeight="";
	document.getElementById("lblFirstName").style.color="";
	}
	if(frmReg.lastName.value==""){
	flag=flag+1;
	document.getElementById("lblLastName").style.fontWeight="bold";
	document.getElementById("lblLastName").style.color="#FF0000";
	}
	else{
	document.getElementById("lblLastName").style.fontWeight="";
	document.getElementById("lblLastName").style.color="";
	}
	if(frmReg.firstName.value!="" && frmReg.lastName.value!="" && (frmReg.firstName.value==frmReg.lastName.value) )
	{
	flag=flag+1;
	//alert("hi");
	//alert
	document.getElementById("samename").style.fontWeight="bold";
	document.getElementById("samename").style.color="#FF0000";
	document.getElementById("samename").style.display=" inline";
	}
	else
	{
		document.getElementById("samename").style.fontWeight="";
		document.getElementById("samename").style.color="";
		
		document.getElementById("samename").style.display="none";
	}
	if(frmReg.address1.value==""){
	flag=flag+1;
	document.getElementById("lblAddress1").style.fontWeight="bold";
	document.getElementById("lblAddress1").style.color="#FF0000";
	}
	else{
	document.getElementById("lblAddress1").style.fontWeight="";
	document.getElementById("lblAddress1").style.color="";
	}
	if(frmReg.country.value==""){
	flag=flag+1;
	document.getElementById("lblCountry").style.fontWeight="bold";
	document.getElementById("lblCountry").style.color="#FF0000";
	}
	else{
	document.getElementById("lblCountry").style.fontWeight="";
	document.getElementById("lblCountry").style.color="";
	}
	if(frmReg.country.value==213 || frmReg.country.value=="" )
	{
	if(frmReg.city.value==""){
	flag=flag+1;
	document.getElementById("lblCity").style.fontWeight="bold";
	document.getElementById("lblCity").style.color="#FF0000";
	}
	else{
	document.getElementById("lblCity").style.fontWeight="";
	document.getElementById("lblCity").style.color="";
	}
	
	if(frmReg.state.value==""){
	flag=flag+1;
	document.getElementById("lblState").style.fontWeight="bold";
	document.getElementById("lblState").style.color="#FF0000";
	}
	else{
	document.getElementById("lblState").style.fontWeight="";
	document.getElementById("lblState").style.color="";
	}
	}
	else
	{
	if(frmReg.province.value==""){
	flag=flag+1;
	document.getElementById("lblProvince").style.fontWeight="bold";
	document.getElementById("lblProvince").style.color="#FF0000";
	}
	else{
	document.getElementById("lblProvince").style.fontWeight="";
	document.getElementById("lblProvince").style.color="";
	}
	}
	if(frmReg.zip.value==""){
	flag=flag+1;
	document.getElementById("lblZip").style.fontWeight="bold";
	document.getElementById("lblZip").style.color="#FF0000";
	}
	else{
	document.getElementById("lblZip").style.fontWeight="";
	document.getElementById("lblZip").style.color="";
	}
	if(frmReg.phoneNumber1.value=="" || frmReg.phoneNumber2.value=="" || frmReg.phoneNumber3.value=="" || !Number(frmReg.phoneNumber1.value) || !Number(frmReg.phoneNumber2.value) || !Number(frmReg.phoneNumber3.value)){
	flag=flag+1;
	document.getElementById("lblPhoneNumber").style.fontWeight="bold";
	document.getElementById("lblPhoneNumber").style.color="#FF0000";
	}
	else{
	document.getElementById("lblPhoneNumber").style.fontWeight="";
	document.getElementById("lblPhoneNumber").style.color="";
	}
	if(frmReg.userName.value==""){
	flag=flag+1;
	document.getElementById("lblUserName").style.fontWeight="bold";
	document.getElementById("lblUserName").style.color="#FF0000";
	}
	else{
	document.getElementById("lblUserName").style.fontWeight="";
	document.getElementById("lblUserName").style.color="";
	}
	
	if(frmReg.password.value==""){
	flag=flag+1;
	document.getElementById("lblPassword").style.fontWeight="bold";
	document.getElementById("lblPassword").style.color="#FF0000";
	}
	else{
	document.getElementById("lblPassword").style.fontWeight="";
	document.getElementById("lblPassword").style.color="";
	}
	
	var permission=frmReg.password.value;
	/*if((permission.length<6) && frmReg.password.value!="")
	{
		alert("Password must be atlest 6 digits!");
		flag=flag+1;
		document.getElementById("lblPassword").style.fontWeight="bold";
	        document.getElementById("lblPassword").style.color="#FF0000";
	}*/
	if(frmReg.password.value!="" && frmReg.userName.value!="")
	{
		
		if(frmReg.password.value==frmReg.userName.value)
		{
			alert("Username and password can not be the same.");
			flag=flag+1;
			document.getElementById("lblPassword").style.fontWeight="bold";
			document.getElementById("lblPassword").style.color="#FF0000";
			
			document.getElementById("lblUserName").style.fontWeight="bold";
			document.getElementById("lblUserName").style.color="#FF0000";
		}
	}
	if(frmReg.password.value!="")
	{
		
	//var patt=/^.*(?=.{6,})(?=.*\d)(?=.*[@#$%^&+=]).*$/;
	var patt=/^.*(?=.{6,})(?=.*[@#$%^&+=\d]).*$/;
	var result=patt.test(permission);
	if(!patt.test(permission))
	{
		alert("Your password length must be 6 also having digits and special characters.");
		flag=flag+1;
		document.getElementById("lblPassword").style.fontWeight="bold";
	        document.getElementById("lblPassword").style.color="#FF0000";
	}
	}
	
	
	if(frmReg.confirmPassword.value==""){
	flag=flag+1;
	document.getElementById("lblConfirmPassword").style.fontWeight="bold";
	document.getElementById("lblConfirmPassword").style.color="#FF0000";
	}
	else{
	document.getElementById("lblConfirmPassword").style.fontWeight="";
	document.getElementById("lblConfirmPassword").style.color="";
	}
	if(frmReg.password.value!=frmReg.confirmPassword.value){
		//alert(frmReg.password.value+" "+frmReg.confirmPassword.value);
		flag=flag+1;
		frmReg.password.value="";
		frmReg.confirmPassword.value="";
		document.getElementById("lblPassword").style.fontWeight="bold";
		document.getElementById("lblPassword").style.color="#FF0000";		
		document.getElementById("lblConfirmPassword").style.fontWeight="bold";
		document.getElementById("lblConfirmPassword").style.color="#FF0000";	
		
	}
	if(frmReg.email.value==""){
	flag=flag+1;
	document.getElementById("lblEmail").style.fontWeight="bold";
	document.getElementById("lblEmail").style.color="#FF0000";
	document.getElementById("lblEmailAgain").style.fontWeight="bold";
	document.getElementById("lblEmailAgain").style.color="#FF0000";	
	frmReg.email.value="";
	frmReg.emailAgain.value="";
	}else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frmReg.email.value)){	
	document.getElementById("lblEmail").style.fontWeight="";
	document.getElementById("lblEmail").style.color="";
	document.getElementById("lblEmailAgain").style.fontWeight="";
	document.getElementById("lblEmailAgain").style.color="";	
	}
	else{
	flag=flag+1;
	document.getElementById("lblEmail").style.fontWeight="bold";
	document.getElementById("lblEmail").style.color="#FF0000";
	document.getElementById("lblEmailAgain").style.fontWeight="bold";
	document.getElementById("lblEmailAgain").style.color="#FF0000";	
	frmReg.email.value="";
	frmReg.emailAgain.value="";
	}
	if(frmReg.email.value!=frmReg.emailAgain.value){
		flag=flag+1;
		frmReg.email.value="";
		frmReg.emailAgain.value="";
		document.getElementById("lblEmail").style.fontWeight="bold";
		document.getElementById("lblEmail").style.color="#FF0000";		
		document.getElementById("lblEmailAgain").style.fontWeight="bold";
		document.getElementById("lblEmailAgain").style.color="#FF0000";	
		
	}
	if(frmReg.secretQuestion.value==""){
	flag=flag+1;
	document.getElementById("lblSecretQuestion").style.fontWeight="bold";
	document.getElementById("lblSecretQuestion").style.color="#FF0000";
	}
	else{
	document.getElementById("lblSecretQuestion").style.fontWeight="";
	document.getElementById("lblSecretQuestion").style.color="";
	}
	if(frmReg.secretAnswer.value==""){
	flag=flag+1;
	document.getElementById("lblSecretAnswer").style.fontWeight="bold";
	document.getElementById("lblSecretAnswer").style.color="#FF0000";
	}
	else{
	document.getElementById("lblSecretAnswer").style.fontWeight="";
	document.getElementById("lblSecretAnswer").style.color="";
	}
	if(frmReg.dMonth.value!="" && frmReg.dDay.value!="" && frmReg.dYear.value!="" && Number(frmReg.dYear.value) && Number(frmReg.dYear.value)>=1900){
	var givenDate=frmReg.dMonth.value+"/"+frmReg.dDay.value+"/"+frmReg.dYear.value;
	var dateToCheck = new Date(givenDate);
    var eighteenYearsAgo = new Date();
  	eighteenYearsAgo.setYear(eighteenYearsAgo.getFullYear() - 18);
  	eighteenYearsAgo.setHours(0);
  	eighteenYearsAgo.setMinutes(0);
  	eighteenYearsAgo.setSeconds(1);

  	if (dateToCheck.getTime() > eighteenYearsAgo.getTime())
  	{
		flag=flag+1;
    	alert("You must be at least 18 years of age.");
		document.getElementById("lblAgeNote").style.fontWeight="bold"; 
		document.getElementById("lblAgeNote").style.color="#FF0000";
		document.getElementById("lblDOB").style.fontWeight="bold"; 
		document.getElementById("lblDOB").style.color="#FF0000";
  	}
   else
   {
	   document.getElementById("lblDOB").style.fontWeight="";
	   document.getElementById("lblDOB").style.color="";
	   document.getElementById("lblAgeNote").style.fontWeight=""; 
	   document.getElementById("lblAgeNote").style.color="";
	   
   }
	}
	else{
	
	flag=flag+1;
	document.getElementById("lblDOB").style.fontWeight="bold"; 
	document.getElementById("lblDOB").style.color="#FF0000";
	}
	if(frmReg.securityCode.value==""){
	flag=flag+1;
	document.getElementById("lblSecurityCode").style.fontWeight="bold";
	document.getElementById("lblSecurityCode").style.color="#FF0000";
	}
	else{
	document.getElementById("lblSecurityCode").style.fontWeight="";
	document.getElementById("lblSecurityCode").style.color="";
	}
	if(frmReg.accept.checked){
	document.getElementById("lblAgreement").style.display="none";
	}
	else{
	flag=flag+1;
	document.getElementById("lblAgreement").style.display="block";
	}
	if(flag>0)
	{
	 document.getElementById("messageAreaTop").innerHTML="<font color='#FF0000'><b>We need some additional information from you. Enter valid information in red color highlighted fields and try again.</b></font>";
	 document.getElementById("messageAreaBottom").innerHTML="<font color='#FF0000'><b>We need some additional information from you. Enter valid information in red color highlighted fields and try again.</b></font>";
	 return false;
	}
	else 
	 return true;
}
function funpostfeedback()
{
	alert("hi");
	/*if(document.getElementById("comment").value=="")
	{
		alert("Please enter comment.");
		return false;
	}
	else
	  return true;*/
}

function validateRegisterMerchant()
{
	
	var frmReg=document.getElementById("frmRegisterMerchant");
	var flag=0;
	
	
	if(frmReg.businessName.value==""){
		flag=flag+1;
		document.getElementById("lblBusinessName").style.fontWeight="bold";
		document.getElementById("lblBusinessName").style.color="#FF0000";
	}
	else{
		document.getElementById("lblBusinessName").style.fontWeight="";
		document.getElementById("lblBusinessName").style.color="";
	}
	
	if(frmReg.utype.value=='5')
	{
		if(frmReg.special_in.value==""){
			flag=flag+1;
			document.getElementById("lblspecial_in").style.fontWeight="bold";
			document.getElementById("lblspecial_in").style.color="#FF0000";
		}
		else{
			document.getElementById("lblspecial_in").style.fontWeight="";
			document.getElementById("lblspecial_in").style.color="";
		}
	}	
	
	if(frmReg.utype.value=='3') //this fields validation is only for merchants
	{
		if(frmReg.physicalLocation.value==""){
			flag=flag+1;
			document.getElementById("lblphysicalLocation").style.fontWeight="bold";
			document.getElementById("lblphysicalLocation").style.color="#FF0000";
		}
		else{
			document.getElementById("lblphysicalLocation").style.fontWeight="";
			document.getElementById("lblphysicalLocation").style.color="";
		}
		if(frmReg.btype.value=="")
		{
			flag=flag+1;
			document.getElementById("lblBusinessType").style.fontWeight="bold";
			document.getElementById("lblBusinessType").style.color="#FF0000";
		}
		else
		{
			document.getElementById("lblBusinessType").style.fontWeight="";
			document.getElementById("lblBusinessType").style.color="";
		}
		
	
	
		if(frmReg.businessDescription.value==""){
			flag=flag+1;
			document.getElementById("lblbusinessDescription").style.fontWeight="bold";
			document.getElementById("lblbusinessDescription").style.color="#FF0000";
		}
		else{
			document.getElementById("lblbusinessDescription").style.fontWeight="";
			document.getElementById("lblbusinessDescription").style.color="";
		}
	}
	
	if(frmReg.address1.value==""){
		flag=flag+1;
		document.getElementById("lblAddress1").style.fontWeight="bold";
		document.getElementById("lblAddress1").style.color="#FF0000";
	}
	else{
		document.getElementById("lblAddress1").style.fontWeight="";
		document.getElementById("lblAddress1").style.color="";
	}
	
	if(frmReg.country.value==""){
		flag=flag+1;
		document.getElementById("lblCountry").style.fontWeight="bold";
		document.getElementById("lblCountry").style.color="#FF0000";
	}
	else{
		document.getElementById("lblCountry").style.fontWeight="";
		document.getElementById("lblCountry").style.color="";
	}
	
	if(frmReg.state.value==""){
		flag=flag+1;
		document.getElementById("lblState").style.fontWeight="bold";
		document.getElementById("lblState").style.color="#FF0000";
	}
	else{
		document.getElementById("lblState").style.fontWeight="";
		document.getElementById("lblState").style.color="";
	}
	
	if(frmReg.city.value==""){
		flag=flag+1;
		document.getElementById("lblCity").style.fontWeight="bold";
		document.getElementById("lblCity").style.color="#FF0000";
	}
	else{
		document.getElementById("lblCity").style.fontWeight="";
		document.getElementById("lblCity").style.color="";
	}
	
	if(frmReg.zip.value==""){
		flag=flag+1;
		document.getElementById("lblZip").style.fontWeight="bold";
		document.getElementById("lblZip").style.color="#FF0000";
	}
	else{
		document.getElementById("lblZip").style.fontWeight="";
		document.getElementById("lblZip").style.color="";
	}
	
	if(frmReg.phoneNumber1.value=="" || frmReg.phoneNumber2.value=="" || frmReg.phoneNumber3.value=="" || !Number(frmReg.phoneNumber1.value) || !Number(frmReg.phoneNumber2.value) || !Number(frmReg.phoneNumber3.value)){
		flag=flag+1;
		document.getElementById("lblPhoneNumberPrimary").style.fontWeight="bold";
		document.getElementById("lblPhoneNumberPrimary").style.color="#FF0000";
	}
	else{
		document.getElementById("lblPhoneNumberPrimary").style.fontWeight="";
		document.getElementById("lblPhoneNumberPrimary").style.color="";
	}
	
	if(frmReg.email.value==""){
		flag=flag+1;
		document.getElementById("lblEmail").style.fontWeight="bold";
		document.getElementById("lblEmail").style.color="#FF0000";
		document.getElementById("lblEmailAgain").style.fontWeight="bold";
		document.getElementById("lblEmailAgain").style.color="#FF0000";	
		frmReg.email.value="";
		frmReg.emailAgain.value="";
	}else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frmReg.email.value)){	
		document.getElementById("lblEmail").style.fontWeight="";
		document.getElementById("lblEmail").style.color="";
		document.getElementById("lblEmailAgain").style.fontWeight="";
		document.getElementById("lblEmailAgain").style.color="";	
	}
	else{
		flag=flag+1;
		document.getElementById("lblEmail").style.fontWeight="bold";
		document.getElementById("lblEmail").style.color="#FF0000";
		document.getElementById("lblEmailAgain").style.fontWeight="bold";
		document.getElementById("lblEmailAgain").style.color="#FF0000";	
		frmReg.email.value="";
		frmReg.emailAgain.value="";
	}
	if(frmReg.email.value!=frmReg.emailAgain.value){
		flag=flag+1;
		frmReg.email.value="";
		frmReg.emailAgain.value="";
		document.getElementById("lblEmail").style.fontWeight="bold";
		document.getElementById("lblEmail").style.color="#FF0000";		
		document.getElementById("lblEmailAgain").style.fontWeight="bold";
		document.getElementById("lblEmailAgain").style.color="#FF0000";	
		
	}
	
	if(frmReg.firstName.value==""){
		flag=flag+1;
		document.getElementById("lblFirstName").style.fontWeight="bold";
		document.getElementById("lblFirstName").style.color="#FF0000";
	}
	else{
		document.getElementById("lblFirstName").style.fontWeight="";
		document.getElementById("lblFirstName").style.color="";
	}
	
	if(frmReg.lastName.value==""){
		flag=flag+1;
		document.getElementById("lblLastName").style.fontWeight="bold";
		document.getElementById("lblLastName").style.color="#FF0000";
	}
	else{
		document.getElementById("lblLastName").style.fontWeight="";
		document.getElementById("lblLastName").style.color="";
	}
	if((frmReg.firstName.value!="" && frmReg.lastName.value!="") && (frmReg.firstName.value==frmReg.lastName.value) )
	{
		flag=flag+1;
		//alert("hi");
		document.getElementById("samename").style.fontWeight="bold";
		document.getElementById("samename").style.color="#FF0000";
		document.getElementById("samename").style.display="inline";
		//return false;
	}
	else {
		$("#samename").hide();
	}
	
	if(!Number(frmReg.phoneNumber4.value) || !Number(frmReg.phoneNumber5.value) || !Number(frmReg.phoneNumber6.value)){
		flag=flag+1;
		document.getElementById("lblPhoneNumberSecondary").style.fontWeight="bold";
		document.getElementById("lblPhoneNumberSecondary").style.color="#FF0000";
	}
	else{
		document.getElementById("lblPhoneNumberSecondary").style.fontWeight="";
		document.getElementById("lblPhoneNumberSecondary").style.color="";
	}
	
	if(frmReg.businessEmail.value==""){
		flag=flag+1;
		document.getElementById("lblbusinessEmail").style.fontWeight="bold";
		document.getElementById("lblbusinessEmail").style.color="#FF0000";
		document.getElementById("lblbusinessEmailAgain").style.fontWeight="bold";
		document.getElementById("lblbusinessEmailAgain").style.color="#FF0000";	
		frmReg.businessEmail.value="";
		frmReg.businessEmailAgain.value="";
	}else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frmReg.businessEmail.value)){	
		document.getElementById("lblbusinessEmail").style.fontWeight="";
		document.getElementById("lblbusinessEmail").style.color="";
		document.getElementById("lblbusinessEmailAgain").style.fontWeight="";
		document.getElementById("lblbusinessEmailAgain").style.color="";	
	}
	else{
		flag=flag+1;
		document.getElementById("lblbusinessEmail").style.fontWeight="bold";
		document.getElementById("lblbusinessEmail").style.color="#FF0000";
		document.getElementById("lblbusinessEmailAgain").style.fontWeight="bold";
		document.getElementById("lblbusinessEmailAgain").style.color="#FF0000";	
		frmReg.businessEmail.value="";
		frmReg.businessEmailAgain.value="";
	}
	if(frmReg.businessEmail.value!=frmReg.businessEmailAgain.value){
		flag=flag+1;
		frmReg.businessEmail.value="";
		frmReg.businessEmailAgain.value="";
		document.getElementById("lblbusinessEmail").style.fontWeight="bold";
		document.getElementById("lblbusinessEmail").style.color="#FF0000";		
		document.getElementById("lblbusinessEmailAgain").style.fontWeight="bold";
		document.getElementById("lblbusinessEmailAgain").style.color="#FF0000";	
		
	}
	
	if(frmReg.driverLicence.value==""){
		flag=flag+1;
		document.getElementById("lbldriverLicence").style.fontWeight="bold";
		document.getElementById("lbldriverLicence").style.color="#FF0000";
	}
	else{
		document.getElementById("lbldriverLicence").style.fontWeight="";
		document.getElementById("lbldriverLicence").style.color="";
	}
	
	if(frmReg.userName.value==""){
		flag=flag+1;
		document.getElementById("lblUserName").style.fontWeight="bold";
		document.getElementById("lblUserName").style.color="#FF0000";
	}
	else{
		document.getElementById("lblUserName").style.fontWeight="";
		document.getElementById("lblUserName").style.color="";
	}
	
	if(frmReg.password.value==""){
		flag=flag+1;
		document.getElementById("lblPassword").style.fontWeight="bold";
		document.getElementById("lblPassword").style.color="#FF0000";
	}
	else{
		document.getElementById("lblPassword").style.fontWeight="";
		document.getElementById("lblPassword").style.color="";
	}
	
	if(frmReg.password.value!="" && frmReg.userName.value!="")
	{
		
		if(frmReg.password.value==frmReg.userName.value)
		{
			alert("Username and password can not be the same.");
			flag=flag+1;
			document.getElementById("lblPassword").style.fontWeight="bold";
			document.getElementById("lblPassword").style.color="#FF0000";
			
			document.getElementById("lblUserName").style.fontWeight="bold";
			document.getElementById("lblUserName").style.color="#FF0000";
		}
	}
		
	var permission=frmReg.password.value;
	/*if((permission.length<6) && frmReg.password.value!="")
	{
		alert("Password must be atlest 6 digits!");
		flag=flag+1;
		document.getElementById("lblPassword").style.fontWeight="bold";
	        document.getElementById("lblPassword").style.color="#FF0000";
	}*/
	
	if(frmReg.password.value!="")
	{
		var patt=/^.*(?=.{6,})(?=.*[@#$%^&+=\d]).*$/;
		var result=patt.test(permission);
		//alert(result+" "+permission);
		if(!patt.test(permission))
		{
			alert("Your password length must be 6 also having digits and special characters.");
			flag=flag+1;
			document.getElementById("lblPassword").style.fontWeight="bold";
			document.getElementById("lblPassword").style.color="#FF0000";
		}
	}
	
	if(frmReg.confirmPassword.value==""){
		flag=flag+1;
		document.getElementById("lblConfirmPassword").style.fontWeight="bold";
		document.getElementById("lblConfirmPassword").style.color="#FF0000";
	}
	else{
		document.getElementById("lblConfirmPassword").style.fontWeight="";
		document.getElementById("lblConfirmPassword").style.color="";
	}
	if(frmReg.password.value!=frmReg.confirmPassword.value){
		flag=flag+1;
		frmReg.password.value="";
		frmReg.confirmPassword.value="";
		document.getElementById("lblPassword").style.fontWeight="bold";
		document.getElementById("lblPassword").style.color="#FF0000";		
		document.getElementById("lblConfirmPassword").style.fontWeight="bold";
		document.getElementById("lblConfirmPassword").style.color="#FF0000";	
		
	}
	
	//alert(frmReg.utype.value);
	
	
	if(frmReg.secretQuestion.value==""){
		flag=flag+1;
		document.getElementById("lblSecretQuestion").style.fontWeight="bold";
		document.getElementById("lblSecretQuestion").style.color="#FF0000";
	}
	else{
		document.getElementById("lblSecretQuestion").style.fontWeight="";
		document.getElementById("lblSecretQuestion").style.color="";
	}
	
	if(frmReg.secretAnswer.value==""){
		flag=flag+1;
		document.getElementById("lblSecretAnswer").style.fontWeight="bold";
		document.getElementById("lblSecretAnswer").style.color="#FF0000";
	}
	else{
		document.getElementById("lblSecretAnswer").style.fontWeight="";
		document.getElementById("lblSecretAnswer").style.color="";
	}
	
	if(frmReg.dMonth.value!="" && frmReg.dDay.value!="" && frmReg.dYear.value!="" && Number(frmReg.dYear.value) && Number(frmReg.dYear.value)>=1900)
	{
		var givenDate=frmReg.dMonth.value+"/"+frmReg.dDay.value+"/"+frmReg.dYear.value;
		var dateToCheck = new Date(givenDate);
		var eighteenYearsAgo = new Date();
		eighteenYearsAgo.setYear(eighteenYearsAgo.getFullYear() - 18);
		eighteenYearsAgo.setHours(0);
		eighteenYearsAgo.setMinutes(0);
		eighteenYearsAgo.setSeconds(1);
		  
		if (dateToCheck.getTime() > eighteenYearsAgo.getTime())
		{
			flag=flag+1;
			alert("You must be at least 18 years of age.");
			document.getElementById("lblAgeNote").style.fontWeight="bold"; 
			document.getElementById("lblAgeNote").style.color="#FF0000";
			document.getElementById("lblDOB").style.fontWeight="bold"; 
			document.getElementById("lblDOB").style.color="#FF0000";
		}
		else
		{
			document.getElementById("lblDOB").style.fontWeight="";
			document.getElementById("lblDOB").style.color="";
			document.getElementById("lblAgeNote").style.fontWeight=""; 
			document.getElementById("lblAgeNote").style.color="";
			
		}
		//alert("hi");
	}
	else{
		//alert(flag);
		flag=flag+1;
		document.getElementById("lblDOB").style.fontWeight="bold"; 
		document.getElementById("lblDOB").style.color="#FF0000";
	}
	
	if(frmReg.securityCode.value==""){
		flag=flag+1;
		document.getElementById("lblSecurityCode").style.fontWeight="bold";
		document.getElementById("lblSecurityCode").style.color="#FF0000";
	}
	else{
		document.getElementById("lblSecurityCode").style.fontWeight="";
		document.getElementById("lblSecurityCode").style.color="";
	}
	if(frmReg.accept.checked){
		document.getElementById("lblAgreement").style.display="none";
	}
	else{
		flag=flag+1;
		document.getElementById("lblAgreement").style.display="block";
	}
       
	if(flag>0)
	{
		
	 document.getElementById("messageAreaTop").innerHTML="<font color='#FF0000'><b>We need some additional information from you. Enter valid information in red color highlighted fields and try again.</b></font>";
	 document.getElementById("messageAreaBottom").innerHTML="<font color='#FF0000'><b>We need some additional information from you. Enter valid information in red color highlighted fields and try again.</b></font>";
	 return false;
	}
	else
	{
	  return true;
	}
}
/////////// Validate Forgot password
function validateForgotPassword()
{
	var frmReg=document.getElementById("frmForgotPassword");
	var flag=0;
	if(frmReg.username.value==""){
	flag=flag+1;
	document.getElementById("lblUsername").style.fontWeight="bold";
	document.getElementById("lblUsername").style.color="#FF0000";
	}
	else{
	document.getElementById("lblUsername").style.fontWeight="";
	document.getElementById("lblUsername").style.color="";
	}
	if(flag>0)
	{
	 document.getElementById("messageArea").innerHTML="<font color='#FF0000'><b>Please enter valid Swapen username.</b></font>";
	 return false;
	}
	else 
	 return true;
}
/////////// Validate Forgot password Confirm
function validateConfirmPassword()
{
	var frmReg=document.getElementById("frmPasswordConfirmMember");
	var flag=0;
	if(frmReg.secretAnswer.value=="")
		flag=flag+1;
	if(frmReg.zip.value=="")
		flag=flag+1;
	if(frmReg.dMonth.value=="" || frmReg.dDay.value=="" || frmReg.dYear.value=="")
		flag=flag+1;
	if(flag>2)
	{
	 document.getElementById("messageArea").innerHTML="<font color='#FF0000'><b>Please answer atleast two or more questions.</b></font>";
	 return false;
	}
	else 
	 return true;
}
/////////// Validate Forgot username
function validateForgotUsername()
{
	var frmReg=document.getElementById("frmForgotPassword");
	var flag=0;
	if(frmReg.username.value==""){
	flag=flag+1;
	document.getElementById("lblUsername").style.fontWeight="bold";
	document.getElementById("lblUsername").style.color="#FF0000";
	}
	else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frmReg.username.value)){
	document.getElementById("lblUsername").style.fontWeight="";
	document.getElementById("lblUsername").style.color="";
	}
	else
	{
		flag=flag+1;
		document.getElementById("lblUsername").style.fontWeight="bold";
		document.getElementById("lblUsername").style.color="#FF0000";
	}
	
	if(flag>0)
	{
	 //document.getElementById("messageArea").innerHTML="<font color='#FF0000'><b>Enter valid Swapen Email</b></font>";
	 document.getElementById("messageArea").innerHTML="<font color='#FF0000'><b>Please enter in the valid email address.</b></font>";
	 return false;
	}
	else 
	 return true;
}
/////////// Validate Confirmation code
function validatePasswordChange()
{
	var frmReg=document.getElementById("frmPasswordChange");
	var flag=0;
	if(frmReg.newPassword.value==""){
	flag=flag+1;
	document.getElementById("lblNewPassword").style.fontWeight="bold";
	document.getElementById("lblNewPassword").style.color="#FF0000";
	}
	else{
	document.getElementById("lblNewPassword").style.fontWeight="";
	document.getElementById("lblNewPassword").style.color="";
	}
	if(frmReg.newPasswordAgain.value==""){
	flag=flag+1;
	document.getElementById("lblNewPasswordAgain").style.fontWeight="bold";
	document.getElementById("lblNewPasswordAgain").style.color="#FF0000";
	}
	else{
	document.getElementById("lblNewPasswordAgain").style.fontWeight="";
	document.getElementById("lblNewPasswordAgain").style.color="";
	}
	if(frmReg.newPassword.value!=frmReg.newPasswordAgain.value){
		flag=flag+1;
		frmReg.newPassword.value="";
		frmReg.newPasswordAgain.value="";
		document.getElementById("lblNewPassword").style.fontWeight="bold";
		document.getElementById("lblNewPassword").style.color="#FF0000";		
		document.getElementById("lblNewPasswordAgain").style.fontWeight="bold";
		document.getElementById("lblNewPasswordAgain").style.color="#FF0000";
	}
	if(flag>0)
	{
	 document.getElementById("messageArea").innerHTML="<font color='#FF0000'><b>Enter valid information in red color highlighted fields</b></font>";
	 return false;
	}
	else 
	 return true;
}
/////////// Validate Confirmation code
function validateConfirmMember()
{
	var frmReg=document.getElementById("frmConfirmMember");
	var flag=0;
	if(frmReg.email.value==""){
	flag=flag+1;
	document.getElementById("lblEmail").style.fontWeight="bold";
	document.getElementById("lblEmail").style.color="#FF0000";
	}
	else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frmReg.email.value)){	
	document.getElementById("lblEmail").style.fontWeight="";
	document.getElementById("lblEmail").style.color="";
	}
	else{
	flag=flag+1;
	document.getElementById("lblEmail").style.fontWeight="bold";
	document.getElementById("lblEmail").style.color="#FF0000";
	}
	if(frmReg.confirmCode.value==""){
	flag=flag+1;
	document.getElementById("lblConfirmCode").style.fontWeight="bold";
	document.getElementById("lblConfirmCode").style.color="#FF0000";
	}
	else{
	document.getElementById("lblConfirmCode").style.fontWeight="";
	document.getElementById("lblConfirmCode").style.color="";
	}
	if(flag>0)
	{
	 document.getElementById("messageArea").innerHTML="<font color='#FF0000'><b>Enter valid information in red color highlighted fields.</b></font>";
	 return false;
	}
	else 
	 return true;
}

////////

//Ajax call for state list 
function funSelectState(val,divId,type){
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }
	
	if(type=='0')
	{
	 if(val!=213 )
	 {
		document.getElementById("popup").style.display="block";
		document.getElementById("user_type").value="2";
		document.getElementById("selstate").style.display="none";
		document.getElementById("selcity").style.display="none";
		document.getElementById("selproviance").style.display="block";
		
		
	 }
	 else
	 {
		document.getElementById("user_type").value="1";
		document.getElementById("selstate").style.display="block";
		document.getElementById("selcity").style.display="block";
		document.getElementById("selproviance").style.display="none";
	 }
	}
	 var url="state_list.php"
	 url=url+"?id="+val	 
	 xmlHttp.open("GET", url, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);	 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}

//Ajax call for city list 
function funSelectCity(val,divId){
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'>";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url="city_list.php"
	 url=url+"?id="+val	 
	 xmlHttp.open("GET", url, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);		 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}

//Ajax call for Expand Product
function funExpandProduct(proId,type,divId,sno){
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url="includes/expand_product.php"
	 url=url+"?proId="+proId+"&type="+type+"&sno="+sno
	 xmlHttp.open("GET", url, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);	 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}
//Ajax call for Contract Product
function funContractProduct(proId,type,divId,sno){
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url="includes/contract_product.php"
	 url=url+"?proId="+proId+"&type="+type+"&sno="+sno
	 xmlHttp.open("GET", url, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);	 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}

//Post product on sell product page
function funSellProduct()
{
  var x=document.getElementById("form1");
  document.getElementById("keyword").value="keyword";
  //validate();
  if(validate())
    x.submit();
}

function funcheckShip() {
	var shipStatus = document.getElementById("ship_status");
	if(shipStatus.checked==true) {
		document.getElementById("pro_ship").value="";
		document.getElementById("pro_ship").disabled=true;
	} else {		
		document.getElementById("pro_ship").disabled=false;
		document.getElementById("pro_ship").focus();
	}
}
function validate()
{
	var pro_name		=document.getElementById("pro_name");
	  
	var pro_subcat		=document.getElementById("pro_subcategory");
	var pro_sub_subcat	=document.getElementById("pro_sub_subcategory");
	
	var pro_commission	=document.getElementById("pro_commission");
	var pro_price		=document.getElementById("pro_price");
	var quantity		=document.getElementById("pro_quantity");
	var sell_type		=document.getElementById("sell_type");
	var pro_description	=document.getElementById("pro_description");
	var seller_name		=document.getElementById("seller_name");
	var email		=document.getElementById("email");
	var pro_quantity	=document.getElementById("pro_quantity");	  
	var shipStatus 		=document.getElementById("ship_status");
	var proShip 		=document.getElementById("pro_ship");
	var proCondition 	=document.getElementById("pro_condition");
	var pro_policy		=document.getElementById("pro_policy");
	var pro_shipping	=document.getElementById("pro_shipping");
	var pro_courior		=document.getElementById("pro_courior");
	 
	submitOK="true";	
		 
	 
	 if (pro_subcat.value=='')	 {
		 alert("Select Product category");
		 pro_subcat.focus();
		 submitOK="false";
		 return false;
	 }	
	 /*if (pro_sub_subcat.value=='')
	 {
		 alert("Select Product subcategory");
		 pro_sub_subcat.focus();
		 submitOK="false";
		 return false;
	 }	
	 */
	 
	 if (pro_name.value=='')
	 {
		 alert("Enter Product name");
		 pro_name.focus();
		 submitOK="false";
		 return false;
	 }	 
	 
	 if (pro_description.value=='')
	 {
		 alert("Product description is necessary");
		 pro_description.focus();
		 submitOK="false";
		 return false;
	 }
	 
	 if (quantity.value=='')
	 {
		 alert("Enter quantity");
		 quantity.focus();
		 submitOK="false";
		 return false;
	 }
	  else if (isNaN(quantity.value))
	 {
		 alert("Quantity must be a number");
		 quantity.focus();
		 submitOK="false";
		 return false;
	 }
	 
	 if (sell_type.value=='')
	 {
		 alert("Select selling type");
		 sell_type.focus();
		 submitOK="false";
		 return false;
	 }
	 
	 
	 if(pro_price.value=='')
	 {
		alert("Enter Product Price");
		pro_price.focus();
		submitOK="false";
		return false;
	 }
	 else if (isNaN(pro_price.value))
	 {
		 alert("Price must be a number");
		 pro_price.focus();
		 submitOK="false";
		 return false;
	 }
	 if(pro_commission)
	 {
	 if(pro_commission.value=='')
	 {
		alert("Enter Commission per product");
		pro_commission.focus();
		submitOK="false";
		return false;
	 }
	 else if (isNaN(pro_commission.value))
	 {
		 alert("Starting bargain Price must be a number");
		 pro_commission.focus();
		 submitOK="false";
		 return false;
	 }
	 
	 }
	 if(shipStatus.checked!=true) {
		if(proShip.value=="") {
			alert("Enter shipping price");
			proShip.focus();
			submitOK="false";
		 	return false;
		} 
		else if(isNaN(proShip.value)) {
			 alert("Shipping Price must be a number");
			 proShip.focus();
			 submitOK="false";
			 return false;
		}
	 }
	 
	 if (proCondition.value=='')
	 {
		 alert("Select product condition");
		 proCondition.focus();
		 submitOK="false";
		 return false;
	 }	 
	 
	 if (pro_courior!=null && pro_courior.value=='')
	 {
		 alert("Select courior type");
		 pro_courior.focus();
		 submitOK="false";
		 return false;
	 }	 
	 
	 if (pro_shipping !=null && pro_shipping.value=='')
	 {
		 alert("Select shipping time");
		 pro_shipping.focus();
		 submitOK="false";
		 return false;
	 }	 
	 
	 if (pro_policy!=null && pro_policy.value=='')
	 {
		 alert("Select return policy");
		 pro_policy.focus();
		 submitOK="false";
		 return false;
	 }
	 
	 if (submitOK=="false")
	 {
	 return false;
	 }
	 else { return true; }
}
//Edit validate
function validateEditPro()
{
	  
	  var pro_subcat=document.getElementById("pro_subcategory");
	  var pro_sub_subcat=document.getElementById("pro_sub_subcategory");
	  var quantity=document.getElementById("pro_quantity");
	  var pro_description=document.getElementById("pro_description");
	  var pro_quantity=document.getElementById("pro_quantity");	  
	 submitOK="true";
	 if (pro_subcat.value=='')	 {
		 alert("Select Product category");
		 pro_subcat.focus();
		 submitOK="false";
		 return false;
	 }	
	 if (pro_description.value=='')
	 {
		 alert("Product description is necessary");
		 pro_description.focus();
		 submitOK="false";
		 return false;
	 }
	 
	 if (quantity.value=='')
	 {
		 alert("Enter quantity");
		 quantity.focus();
		 submitOK="false";
		 return false;
	 }
	  else if (isNaN(quantity.value))
	 {
		 alert("Quantity must be a number");
		 quantity.focus();
		 submitOK="false";
		 return false;
	 }
	 if (submitOK=="false")
	 {
	 return false;
	 }
	 else { return true; }
}
//delete product
function funDelProduct(frm,type,proId) {	
	//var delPro=confirm("Are you sure want to delete your product?");
    //if(delPro==true) {
	  var x=document.getElementById(frm);
	  document.getElementById("hidDelPro").value=proId;
	  document.getElementById("hidDelProKey").value=type;
	  x.submit();
    //}
}

//delete products selling for others
function funDelProOthers(frm,type,proId) {		
	var delPro=confirm("Are you sure want to delete your product?");
    if(delPro==true) {
	  var x=document.getElementById(frm);
	  document.getElementById("delPro").value=proId;
	  document.getElementById("delProKey").value=type;
	  x.submit();
    }
}

//edit product
function funEditProduct(proId) {
    var x=document.getElementById("form1");
    document.getElementById("keyword").value=proId;
    if(validateEditPro())
    x.submit();	
}


function getSubcat(val,divId){
	 document.getElementById("loader-div").innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  }	  
	 var url1="get_subcategory.php"
	 url1=url1+"?id="+val	 
	 xmlHttp.open("GET", url1, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);		 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById("loader-div").innerHTML="";
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}

//get sub sub category
function getSubSubCat(val,divId){
	 document.getElementById("loader-div1").innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	  }	  
	 var url1="get_sub_subcategory.php"
	 url1=url1+"?id="+val	 
	 xmlHttp.open("GET", url1, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);		 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById("loader-div1").innerHTML="";
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}

//function to add bargain for Buyer
function funBargain(){	 
	 frm=document.frmProductInfo;	 
	 document.getElementById('hidBargain').value="add";	
	 if(bargainValidate()) {
	 	frm.submit();
	 }
}
function bargainValidate()
{
	  //var ask_price=document.getElementById("asking_price");
	  var off_price=document.getElementById("offer_price");	  
	  var bar_comment=document.getElementById("bargain_comment");
	  
	 submitOK="true";
	 
	/* if(ask_price.value=='')
	 {
		alert("Asking price empty");
		ask_price.focus();
		submitOK="false";
		return false;
	 }
	 else if (isNaN(ask_price.value))
	 {
		 alert("Asking Price must be a number");
		 ask_price.focus();
		 submitOK="false";
		 return false;
	 }*/
	 
	  if(off_price.value=='')
	 {
		alert("Enter Offer Price");
		off_price.focus();
		submitOK="false";
		return false;
	 }
	 else if (isNaN(off_price.value))
	 {
		 alert("Offer Price must be a number");
		 off_price.focus();
		 submitOK="false";
		 return false;
	 }
	 
	 if (submitOK=="false")
	 {
	 	return false;
	 }
	 else { return true; }
}
//function to add bargain for Seller
function funBargainSeller(){	 
	 frm=document.frmProductInfo;	 
	 document.getElementById('hidBargain').value="add";	
	 if(bargainSellerValidate()) {
	 	frm.submit();
	 }
}
function bargainSellerValidate()
{
	 // var ask_price=document.getElementById("asking_price");
	  var off_price=document.getElementById("offer_price");	  
	  //var ask_commission=document.getElementById("asking_commission");
	  //var off_commission=document.getElementById("offer_commission");
	  var bar_comment=document.getElementById("bargain_comment");
	 submitOK="true";
	 
	/* if(ask_price.value=='')
	 {
		alert("Asking price empty");
		ask_price.focus();
		submitOK="false";
		return false;
	 }
	 else if (isNaN(ask_price.value))
	 {
		 alert("Asking Price must be a number");
		 ask_price.focus();
		 submitOK="false";
		 return false;
	 }*/
	  if(off_price.value=='')
	 {
		alert("Enter offer price");
		off_price.focus();
		submitOK="false";
		return false;
	 }
	 
	if (isNaN(off_price.value))
	 {
		 alert("Offer Price must be a number");
		 off_price.focus();
		 submitOK="false";
		 return false;
	 }
	 /*else if (isNaN(off_commission.value))
	 {
		 alert("Offer Commission must be a number");
		 off_commission.focus();
		 submitOK="false";
		 return false;
	 }*/
	 
	 if (submitOK=="false")
	 {
	 	return false;
	 }
	 else { return true; }
}
//function to Edit selling product - other
function funEditProductOtherForm(itemId) {
	  var x=document.getElementById("frmProListOthers");
	  document.getElementById("hidEditSellingItemothers").value=itemId;
	  x.action="index.php?mySwapen#editOthers";
	  x.submit();
}
function funEditSellingProductOther(itemId){	 
	 frm=document.frmEditSellingProduct;	 
	 document.getElementById('editSellingProductOtherKey').value=itemId;	
	 if(editSellingProductOtherValidate()) {
	 	frm.submit();
	 }
}
function editSellingProductOtherValidate()
{
	 var commission=document.getElementById("commission");
	 if(commission.value=='')
	 {
		alert("Commission must not empty");
		ask_price.focus();
		submitOK="false";
		return false;
	 }
	 else
	  return true;
}
//function to Edit selling product - Own Products
function funEditItemOwnForm(frm,itemId) {
	  var x=document.getElementById(frm);
	  document.getElementById("hidEditSellingItemOwn").value=itemId;
	  x.action="index.php?mySwapen#editOwn";
	  x.submit();
}
function funEditSellingProductOwn(frm,itemId){
	 var x=document.getElementById(frm);
	 document.getElementById('editSellingProductOwnKey').value=itemId;	
	 if(editSellingProductOwnValidate()) {
	 	x.submit();
	 }
}
function editSellingProductOwnValidate()
{
	 var price=document.getElementById("price");
	 var commission=document.getElementById("commission");
	 if(price.value=='')
	 {
		alert("price must not empty");
		price.focus();
		submitOK="false";
		return false;
	 }
	 if(commission.value=='')
	 {
		alert("Commission must not empty");
		commission.focus();
		submitOK="false";
		return false;
	 }
	 else
	  return true;
}

//function to add wishlist
function funAddList(val,userid,divId){
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null) {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url1="add_to_wishlist.php"
	 url1=url1+"?wid="+val+"&user="+userid	 
	 xmlHttp.open("GET", url1, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);	 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}

//function to add wishlist for wholeseller
function funAddWholeList(val,userid,divId){
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null) {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url1="add_to_whole_wishlist.php"
	 url1=url1+"?wid="+val+"&user="+userid	 
	 xmlHttp.open("GET", url1, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);	 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}

//function to add Product to sellers list
function funAddItem(val,userid,divId,duration){
	//alert(val);
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp==null) {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url1="add_to_seller.php"
	 url1=url1+"?pid="+val+"&user="+userid+"&duration="+duration
	 xmlHttp.open("GET", url1, true);
	 xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp.send(null);	 
	 xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp.responseText;
		}
	 }	 	
}
//add class to field
function addClass(element, value) {
	if(!element.className) {
		element.className = value;
	} else {
		newClassName = element.className;
		newClassName+= " ";
		newClassName+= value;
		element.className = newClassName;
	}
}

function removeClass(element) {
	if(element.className) {
		element.className="";
	}
}

function funEditProfile() {
	var frm = document.frmEditProfile;	
	
	if(document.getElementById("firstName").value=="") {		
		fname=1;
		addClass(document.getElementById('lblFirstName'), 'errorField');
	}
	else {
		fname=0;
		removeClass(document.getElementById('lblFirstName'));
	}
	
	if(document.getElementById("lastName").value=="") {		
		lname=1;
		addClass(document.getElementById('lblLastName'), 'errorField');
	}
	else {
		lname=0;
		removeClass(document.getElementById('lblLastName'));
	}
	
	if(document.getElementById("address1").value=="") {		
		add1=1;
		addClass(document.getElementById('lblAddress1'), 'errorField');
	}
	else {
		add1=0;
		removeClass(document.getElementById('lblAddress1'));
	}
	
	if(frm.city.value==""){
		ucity=1;
		addClass(document.getElementById('lblCity'), 'errorField');	
	}
	else {
		ucity=0;
		removeClass(document.getElementById('lblCity'));
	}
	
	if(frm.country.value==""){
		cnty=1;
		addClass(document.getElementById('lblCountry'), 'errorField');		
	}
	else{
		cnty=0;
		removeClass(document.getElementById('lblCountry'));
	}
	
	if(frm.state.value==""){
		st=1;
		addClass(document.getElementById('lblState'), 'errorField');		
	}
	else{
		st=0;
		removeClass(document.getElementById('lblState'));
	}
	
	if(frm.zip.value==""){
		uzip=1;
		addClass(document.getElementById('lblZip'), 'errorField');	
	}
	else{
		uzip=0;
		removeClass(document.getElementById('lblZip'));
	}
	
	if(frm.phoneNumber1.value=="" || frm.phoneNumber2.value=="" || frm.phoneNumber3.value=="" || !Number(frm.phoneNumber1.value) || !Number(frm.phoneNumber2.value) || !Number(frm.phoneNumber3.value)){
		uphone=1;
		addClass(document.getElementById('lblPhoneNumber'), 'errorField');	
	}
	else{
		uphone=0;
		removeClass(document.getElementById('lblPhoneNumber'));
	}
		
	if(frm.email.value==""){
		mail=1;
		addClass(document.getElementById('lblEmail'), 'errorField');	
	}else { 
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frm.email.value))){				
			mail=1;
			addClass(document.getElementById('lblEmail'), 'errorField');	
		}else{
			mail=0;
			removeClass(document.getElementById('lblEmail'));
		}		
	}
	
	//alert(err);
	
	if(fname==1 || lname==1 || add1==1 || ucity==1 || cnty==1 || st==1 || uphone==1 || mail==1  || uzip==1) {
		document.getElementById("messageArea").innerHTML="<font color='#FF0000'><b>Enter valid information in red color highlighted fields.</b></font>";
		return false;
	}
	else {
		return true;
	}
}


//delete wishlist product

function funDelWishlist(wishlistId) {	
	  var del=confirm("Are you sure want to delete your wishlist?");
      if(del==true) {
		  var x=document.getElementById("frmWishlist");
		  document.getElementById("hidDelWishlist").value=wishlistId;
		  x.submit();
	  }
}
function showAddWishlist(val,divId) {	
//document.getElementById("divAddWishlist").style.display="block";
	document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp1 = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp1==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url="add_own_wishlist.php"
	 url=url+"?id="+val	 
	 xmlHttp1.open("GET", url, true);
	 xmlHttp1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp1.send(null);	 
	 xmlHttp1.onreadystatechange = function() {
		if (xmlHttp1.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp1.responseText;
		}
	 }	 
} 

function addToWishlist() {	
	  var x=document.getElementById("frmAddWishList");
	  document.getElementById("addWishListKey").value="true";
	  
	  if(document.getElementById("hidUserType").value=='4') {
		  x.action="index.php?mySwapen&buyer";
	  } else {		  
		  x.action="index.php?mySwapen#wishlist";
		  //x.action="index.php?mySwapen";
	  }
	  
	  if(funValWish("frmAddWishList")) {
	  	x.submit();
	  }
}

function funEditWishlistForm(wishlistId, divId) {	
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp1 = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp1==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url="edit_own_wishlist.php"
	 url=url+"?id="+wishlistId	 
	 xmlHttp1.open("GET", url, true);
	 xmlHttp1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp1.send(null);	 
	 xmlHttp1.onreadystatechange = function() {
		if (xmlHttp1.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp1.responseText;
		}
	 }	 
}

function funEditWWishlistForm(wishlistId, divId) {	
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp1 = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp1==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url="edit_own_wwishlist.php"
	 url=url+"?id="+wishlistId	 
	 xmlHttp1.open("GET", url, true);
	 xmlHttp1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp1.send(null);	 
	 xmlHttp1.onreadystatechange = function() {
		if (xmlHttp1.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp1.responseText;
		}
	 }	 
}

function editWishlist(wishId) {
	  var x=document.getElementById("frmEditWishList");
	  document.getElementById("editWishListKey").value=wishId;
	  
	  if(document.getElementById("hidUserType").value=='4') {
		  x.action="index.php?mySwapen&buyer";
	  } else {		  
		  x.action="index.php?mySwapen#wishlist";
	  }
	  
	  if(funValWish("frmEditWishList")) {
	  	x.submit();
	  }
}

function funEditWishOrder() {	
	  var x=document.getElementById("frmWishlist");	    
	  document.getElementById("hidOrderWishlist").value="changeorder";
	  x.action="index.php?mySwapen&buyer";
	  x.submit();
}

//validate wishlist
function funValWish(frmName) {	
	var frm = document.getElementById(frmName);			
	 if(frm.hidWishlistType.value=='2') {	 
		 if(frm.productName.value=="") {
				alert("Enter product name");
				frm.productName.focus();
				return false;
		  }
	 }
	 
	 if(frm.wishprice.value=="") {
			alert("Enter product wish price");
			frm.wishprice.focus();
			return false;
	 }
	 
	 if(frm.wishprice.value!="") {	
		  if(isNaN(frm.wishprice.value)) {
			 alert("Wish Price must be a number");
			 frm.wishprice.focus(); 
			 return false;
		  }
	 }
	return true;
}

function putIndicator(that,format) {
if (that.value == "")
that.value=format;
}
function clearIndicator(that,format) {
if(that.value==format) 
that.value='';
}


//function for post jobs, real estate, etc....
//Ajax call for getting post fields
function funGetFields(val,divId){
	 document.getElementById(divId).innerHTML="<img src='images/spinningLoader.gif'> Please wait..";
	 xmlHttp1 = GetXmlHttpObject();  //create object for http request
	 if (xmlHttp1==null)  {
		  alert ("Your browser does not support AJAX!");
		  return;
	 }	  
	 var url="get_post_fields.php"
	 url=url+"?id="+val	 
	 xmlHttp1.open("GET", url, true);
	 xmlHttp1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	 xmlHttp1.send(null);	 
	 xmlHttp1.onreadystatechange = function() {
		if (xmlHttp1.readyState==4) { 
		document.getElementById(divId).innerHTML=xmlHttp1.responseText;
		}
	 }	 
}

function funPost()
{
  var x=document.getElementById("frmPost");
  document.getElementById("keyword").value="keyword";
  if(funValPost())
    x.submit();
}

function funValPost()
{
	  var postName=document.getElementById("post_name");	  
	  var postCat=document.getElementById("post_category");
	  //var postSubCat=document.getElementById("post_subcategory");	  
	  var postDesc=document.getElementById("post_description");	
	  var loc = document.getElementById("post_location");
	  var postType=document.getElementById("hidCatType");	 
	 //alert(postType.value);
	 submitOK="true";
	 
	 if (postCat.value=='')
	 {
		 alert("Select Post category");
		 postCat.focus();
		 submitOK="false";
		 return false;
	 }	
	 /*if (postSubCat.value=='')
	 {
		 alert("Select Post subcategory");
		 postSubCat.focus();
		 submitOK="false";
		 return false;
	 }	*/
	 
	 if (postName.value=='')
	 {
		 alert("Enter Post name");
		 postName.focus();
		 submitOK="false";
		 return false;
	 }
	 if (postDesc.value=='')
	 {
		 alert("Post description is necessary");
		 postDesc.focus();
		 submitOK="false";
		 return false;
	 }	 
	 if(loc.value=="") {
		alert("Enter post location");
		loc.focus();
		submitOK="false";
		return false;
	}
	 
	 if(postType.value!="") {
			//alert("Enter job salary");
			var jobprice = document.getElementById("jobprice");
			var rentprice = document.getElementById("rentprice");
			var realprice = document.getElementById("realprice");
			var serviceprice = document.getElementById("serviceprice");
			if(postType.value=="job")  {
							
				if(jobprice.value=="") {
					alert("Enter job salary");
					jobprice.focus();
					submitOK="false";
					return false;
				}
				else if (isNaN(jobprice.value))
				{
					 alert("Job salary must be a number");
					 price.focus();
					 submitOK="false";
					 return false;
				}
				var emailID = document.getElementById("email");
				if ((emailID.value==null)||(emailID.value=="")){
					alert("Please Enter your Email ID")
					emailID.focus()
					return false
				}
				if (echeck(emailID.value)==false){
					emailID.value=""
					emailID.focus()
					return false
				}
	
			}
			
			if(postType.value=="realstate")  {
							
				if(realprice.value=="") {
					alert("Enter real state price");
					realprice.focus();
					submitOK="false";
					return false;
				}
				else if (isNaN(realprice.value))
				{
					 alert("price must be a number");
					 realprice.focus();
					 submitOK="false";
					 return false;
				}
				
			}
			if(postType.value=="service")  {
							
				if(serviceprice.value=="") {
					alert("Enter service price");
					serviceprice.focus();
					submitOK="false";
					return false;
				}
				else if (isNaN(serviceprice.value))
				{
					 alert("price must be a number");
					 serviceprice.focus();
					 submitOK="false";
					 return false;
				}
			}
			else if(postType.value=="rent") {
				var bed = document.getElementById("bedrooms");
				var bath = document.getElementById("bathrooms");
				if(bed.value=="") {
					alert("Enter number of bed rooms");
					bed.focus();
					submitOK="false";
					return false;
				}
				else if (isNaN(bed.value))
				{
					 alert("Bedrooms must be a number");
					 bed.focus();
					 submitOK="false";
					 return false;
				}
				
				if(bath.value=="") {
					alert("Enter number of bath rooms");
					bath.focus();
					submitOK="false";
					return false;
				}
				else if (isNaN(bath.value))
				{
					 alert("Bathrooms must be a number");
					 bath.focus();
					 submitOK="false";
					 return false;
				}				
				
				
				if(rentprice.value=="") {
					alert("Enter rent price");
					rentprice.focus();
					submitOK="false";
					return false;
				}
				else if (isNaN(rentprice.value))
				{
					 alert("price must be a number");
					 rentprice.focus();
					 submitOK="false";
					 return false;
				}
			
			}
			else if(postType.value=="service") {
				if(price.value=="") {
					alert("Enter price for service");
					price.focus();
					submitOK="false";
					return false;
				}
				else if (isNaN(price.value))
				{
					 alert("Price must be a number");
					 price.focus();
					 submitOK="false";
					 return false;
				}
			}
	 }
	 
	 	 	 	 	 
	 if (submitOK=="false")  {
		 return false;
	 }
	 else { return true; }
}
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmSample.txtEmail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }

function openWindow(url,width,height)
{
window.open(url,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width="+width+", height="+height+"");
}

function contactValidate()
{
	if(document.frmContact.txtSub.value=="")
	{
		alert("Please enter your subject");
		return false;
	}
	
	if(document.frmContact.txtName.value=="")
	{
		alert("Please enter your name");
		return false;
	}
	if(document.frmContact.txtEmail.value=="")
	{
		alert("Please enter your email");
		return false;
	}
	
	if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.frmContact.txtEmail.value))){				
		alert("Please enter valid Email");
		return false;
	}
	
	if(document.frmContact.txtQuery.value=="")
	{
		alert("Please enter your query");
		return false;
	}
}
function suggestionValidate()
{
	if(document.frmContact.txtSub.value=="")
	{
		alert("Please enter your subject");
		return false;
	}
	
	if(document.frmContact.txtQuery.value=="")
	{
		alert("Please enter your query");
		return false;
	}
}

function show_hide_s_boxes(box)
{
	if($('#'+box).is(':visible'))
	{
		only_close(box);
	}
	else
	{
		only_open(box);
	}
	
}
function only_close(box)
{
	$('#arrow_'+box).attr('class','orangearosml');
	$('#'+box).hide();
	//alert(box);
	if(box!='myswapen_refcomm' || box!='tran_history' || box!='feedback_pending_merc' )
	{
		$('#star_'+box).hide();
		$('#more_info_'+box).hide();
	}
	$('#hr_line_'+box).show();
	if(box=='comm_pay' || box=='myswapen_refcomm' || box=='tran_history' || box=='feedback_pending_merc')
	{
		$('#other1_'+box).hide();
	}
}
function only_open(box)
{
	//alert(box);
	$('#arrow_'+box).attr('class','greyarrowsml');
	$('#'+box).show();
	if(box!='myswapen_refcomm' || box!='tran_history' || box!='feedback_pending_merc' )
	{
		$('#star_'+box).show();
		$('#more_info_'+box).show();
	}
	$('#hr_line_'+box).hide();
	if(box=='comm_pay' || box=='myswapen_refcomm' || box=='tran_history' || box=='feedback_pending_merc')
	{
		$('#other1_'+box).show();
	}
}

function defaultset(utype,rec)
{
	//alert("tt"+utype+"rec"+rec);
	if(utype=='merchant')
	{
		if(rec==0)
		{
		   only_close('your_inventory');
		}
		only_open('comm_pay');
		only_open('post_listing');
		only_open('classifieds1');
		only_open('myswapen_refcomm');
		only_open('tran_history');
		only_open('feedback_pending_merc');
		only_open('panel_mwishlist');
	}
}
function minimize_all(utype)
{
	//alert(utype);
	if(utype=='merchant')
	{
		//alert("minimize");
		only_close('your_inventory');
		only_close('comm_pay');
		only_close('post_listing');
		only_close('classifieds1');
		only_close('myswapen_refcomm');
		only_close('tran_history');
		only_close('feedback_pending_merc');
		only_close('panel_mwishlist');
	}
	else if(utype=='wholesaler')
	{
		only_close('your_inventory');
		only_close('sell_u_p');
		only_close('post_listing');
		only_close('classifieds1');
		only_close('feedback_pending_merc');
		only_close('tran_history');
	}
	else if(utype=='seller')
	{ 
		only_close('sell_u_p');
		only_close('sell_p_f_o_u');
		only_close('your_inventory');
		only_close('classifieds1');
		only_close('myswapen_refcomm');
		only_close('comm_pay');
		only_close('feedback_pending_merc');
		only_close('post_listing');
		only_close('tran_history');
	}
	else if(utype=='buyer')
	{
		only_close('sell_u_p');
		only_close('panel_wishlist');
		only_close('myswapen_refcomm');
		only_close('classifieds1');
		only_close('feedback_pending_merc');
		only_close('tran_history');
		only_close('post_listing');
		
	}
	$('#m_all').html('Maximize All<br /><div class="bluearrowsml_up" onclick="maximize_all(\''+utype+'\')" id="big_blue_arrow">&nbsp;</div>');

	//$('#big_blue_arrow').attr({class:'bluearrowsml_up',onclick:'maximize_all(\''+utype+'\')'});
}
function maximize_all(utype)
{
	//alert(utype);
	if(utype=='merchant')
	{
		//alert("maximize");
		only_open('your_inventory');
		only_open('comm_pay');
		only_open('post_listing');
		only_open('classifieds1');
		only_open('myswapen_refcomm');
		only_open('tran_history');
		only_open('feedback_pending_merc');
		only_open('panel_mwishlist');
	}
	else if(utype=='wholesaler')
	{
		only_open('your_inventory');
		only_open('sell_u_p');
		only_open('post_listing');
		only_open('classifieds1');
		only_open('feedback_pending_merc');
		only_open('tran_history');
	}
	else if(utype=='seller')
	{
		only_open('sell_u_p');
		only_open('sell_p_f_o_u');
		only_open('classifieds1');
		only_open('your_inventory');
		only_open('myswapen_refcomm');
		only_open('comm_pay');
		only_open('feedback_pending_merc');
		only_open('post_listing');
		only_open('tran_history');
	}
	else if(utype=='buyer')
	{
		only_close('sell_u_p');
		only_open('panel_wishlist');
		only_open('myswapen_refcomm');
		only_open('classifieds1');
		only_open('feedback_pending_merc');
		only_open('tran_history');
		only_open('post_listing');
		
	}
	$('#m_all').html('Minimize All<br /><div class="bluearrowsml" onclick="minimize_all(\''+utype+'\')" id="big_blue_arrow">&nbsp;</div>');
}

function format_value(txtid)
{
	//alert(txtid);
	var decimals = 2;
	var temp_pnumber = $('#'+txtid).val();
	var pnumber= $('#'+txtid).val();
	
	//if already $ is there than it will remove it
	if(temp_pnumber!='')
	{
		if(temp_pnumber.indexOf('$')==0)
		{
			var s_t_p = temp_pnumber.split('$');
			pnumber = s_t_p[1];
		}
	}
	
		
	
	if (isNaN(pnumber))
	{
		alert('Please enter valid amount ');
		$('#'+txtid).val('$');
	}
	else if (pnumber=='') {
		alert('Please enter valid amount');
		$('#'+txtid).val('$');
	}
	else
	{
		if(String(pnumber).substr(-1)==".")
		{
			//pnumber=
			pnumber = pnumber.slice(0, -1);
			
		}
		var snum = new String(pnumber);
		var sec = snum.split('.');
		var whole = parseFloat(sec[0]);
		var result = '';
		
		if(sec.length > 1){
			var dec = new String(sec[1]);
			dec = String(parseFloat(sec[1])/Math.pow(10,(dec.length - decimals)));
			dec = String(whole + Math.round(parseFloat(dec))/Math.pow(10,decimals));
			var dot = dec.indexOf('.');
			if(dot == -1){
				dec += '.'; 
				dot = dec.indexOf('.');
			}
			while(dec.length <= dot + decimals) { dec += '0'; }
			result = dec;
		} else{
			var dot;
			var dec = new String(whole);
			dec += '.';
			dot = dec.indexOf('.');		
			while(dec.length <= dot + decimals) { dec += '0'; }
			result = dec;
		}	
		$('#'+txtid).val('$'+result);
	}
}

function show_more_info(a)
{
	if(a==1)
	{ 
		var pos = $('#bargain_price_more_info').position();
		var nleft = parseInt(pos.left);
		var ntop = parseInt(pos.top)+15;
		$('#more_info').css({'left': nleft, 'top':ntop});  
		$('#desc_info_n').html('Bargain price option will give the buyer an opportunity to send an offer towards your product.');
		$('#more_info').fadeIn('slow');
	}
	else if(a==2)
	{
		var pos = $('#local_pickup_more_info').position();
		var nleft = parseInt(pos.left);
		var ntop = parseInt(pos.top)+15;
		$('#more_info').css({'left': nleft, 'top':ntop});
		$('#desc_info_n').html('Local Pick up is an option for members who want to provide buyers an extra option to receive their products directly from the source. The buyer receives a 10 digit code for the pick-up, which he will provide you with for verification of transaction.');
		$('#more_info').fadeIn('slow');
	}
	else if(a==3)
	{
		var pos = $('#commission_more_info').position();
		var nleft = parseInt(pos.left);
		var ntop = parseInt(pos.top)+15;
		$('#more_info').css({'left': nleft, 'top':ntop});
		//$('#desc_info_n').html('Bargain commission option will give the seller an opportunity to send an offer towards the commission you set.');
		$('#desc_info_n').html('Commission is an incentive you are paying your sellers to spread the word about your product upon sale. The higher commission you provide the more sellers will pick up your products.');
		$('#more_info').fadeIn('slow');
	}
	else if(a==4)
	{
		var pos = $('#bargain_commission_more_info').position();
		var nleft = parseInt(pos.left);
		var ntop = parseInt(pos.top)+15;
		$('#more_info').css({'left': nleft, 'top':ntop});
		//$('#desc_info_n').html('Commission is an incentive you are paying your sellers to spread the word about your product upon sale. The higher commission you provide the more sellers will pick up your products.');
		$('#desc_info_n').html('Bargain commission option will give the seller an opportunity to send an offer towards the commission you set.');
		$('#more_info').fadeIn('slow');
	}
	else if(a==5)
	{
		var pos = $('#sales_tax_more_info').position();
		var nleft = parseInt(pos.left);
		var ntop = parseInt(pos.top)+15;
		$('#more_info').css({'left': nleft, 'top':ntop});
		$('#desc_info_n').html('Sales tax is optional, for sellers who need to charge per transaction within the specific state they are doing business in.');
		$('#more_info').fadeIn('slow');
	}
	else if(a==6)
	{
		var pos = $('#amazon_more_info').position();
		var nleft = parseInt(pos.left);
		var ntop = parseInt(pos.top)+15;
		$('#more_info').css({'left': nleft, 'top':ntop});
		$('#desc_info_n').html('Members need to setup with Amazon to be able to sell on Swapen.com. It\'s 100% free and will take a couple of minutes to create. Note: if you have been kicked off Amazon, you can still sell on Swapen.com through Amazon');
		$('#more_info').fadeIn('slow');
	}
	
}